﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://wubiyu.cnblogs.com">
<head>
      <title></title>
      <link href="../../Theme/DomExtGray/gray.min.css" rel="Stylesheet" type="text/css" />
      <link href="PageModel.css" rel="Stylesheet" type="text/css" />
      <script type="text/javascript" src="../../domExt.min.js"></script>
</head>
<body>
      <div class="fun_title">
            _h.AddInterval(name,callFnStr,delay);
      </div>
      <div class="fun_content">
            描述：此方法可按照指定的周期（以 delay 毫秒计）来调用函数(callFnStr)和表达式。<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 直到 _h.ClearInterval() 被调用或窗口被关闭。</div>
      <div class="fun_title2">
            参数:
      </div>
      <div class="fun_content2">
           name：名称标识<br />
            callFnStr：调用周期执行函数的字符串。<br />
            delay ：每隔多少毫秒执行一次<br />
            <strong>Retrun:</strong><br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            name：名称标识<br /><br />
      </div>
      <div class="fun_title2">
            示例:
      </div>
      <div class="code">
            &lt;script type=&quot;text/javascript&quot;&gt;<br />
&nbsp;&nbsp;&nbsp; var i=0;<br />
&nbsp;&nbsp;&nbsp; function t(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(i);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(i==5)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _h.ClearInterval(&quot;t1&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i=i+1;<br />
            &nbsp;&nbsp;&nbsp; }<br />
            &nbsp;&nbsp;&nbsp; _h.AddInterval(&quot;t1&quot;,&quot;t()&quot;,1000);<br />
&nbsp;&nbsp;&nbsp; _h.AddInterval(&quot;t1&quot;,t,1000);<br />
            &lt;/script&gt;</div>
      <br />
      <h:btn onclick="run_click();">执行脚本</h:btn>
      <div id="htmltemp" style="display:none;"></div>
      <script type="text/javascript">
            var i = 0;
            function t() {
                  alert(i);
                  if (i == 5)
                        _h.ClearInterval("t1");
                  i = i + 1;
            }
            function run_click() {
                  _h.AddInterval("t1", t, 1000);
            }
      </script>
</body>
</html>
